package com.lx.onbording.vshe.testassignment.core.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
@Table
@NamedQuery(name="product.byId", query="from Product p where p.id = :id")
public class Product implements Serializable{
	
	private static final long serialVersionUID = 7241703058025496426L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column	
	private Long id;
	
	@Column
	private String name;
	
	@Embedded
	private Money price;
	
	@Column
	private Integer avalilableQuantity;
	
	public Product() {
		super();	
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Money getPrice() {
		return price;
	}

	public void setPrice(Money price) {
		this.price = price;
	}

	public Integer getAvalilableQuantity() {
		return avalilableQuantity;
	}

	public void setAvalilableQuantity(Integer avalilableQuantity) {
		this.avalilableQuantity = avalilableQuantity;
	}

	@Override
	public String toString() {
		return "Item [id=" + id + ", name=" + name + ", price=" + price
				+ ", avalilableQuantity=" + avalilableQuantity + "]";
	}

	
}
